<template>
	<view class="">
		<u-tabbar :value="value" @change="change" inactiveColor='#444444' :activeColor="zt_c" zIndex='999'>
			<u-tabbar-item :text="item.name" :name='item.id' v-for="(item,index) in list" :key="item.id">
				<image class="img5048" :style="[item.imgSty]" slot="active-icon" :src="item.imagea"></image>
				<image class="img5048" :style="[item.imgSty]" slot="inactive-icon" :src="item.image"></image>
			</u-tabbar-item>
		</u-tabbar>

		<!--使用   <tabbar :value="0"></tabbar>	-->
	</view>
</template>

<script>
	/*
	value 每个tabbar的id值
	*/
	export default {
		props: {
			value: {
				type: Number,
				default: 0,
			}
		},
		data() {
			return {
				list: [{
						id: 1,
						name: '首页',
						url: '/pages/index/index',
						image: require('@/static/tabbar/index.png'),
						imagea: require('@/static/tabbar/indexa.png'),
						imgSty: {
							// width: '40rpx',
							// height: '44rpx'
						}
					},
					{
						id: 2,
						name: '信用卡',
						url: '/pages/credit/credit',
						image: require('@/static/tabbar/credit.png'),
						imagea: require('@/static/tabbar/credita.png'),
						imgSty: {
							// width: '40rpx',
							// height: '44rpx'
						}
					},
					{
						id: 3,
						name: '财富',
						url: '/pages/wealth/wealth',
						image: require('@/static/tabbar/wealth.png'),
						imagea: require('@/static/tabbar/wealtha.png'),
						imgSty: {
							// width: '40rpx',
							// height: '44rpx'
						}
					},
					{
						id: 4,
						name: '生活',
						url: '/pages/live/live',
						image: require('@/static/tabbar/live.png'),
						imagea: require('@/static/tabbar/livea.png'),
						imgSty: {
							// width: '40rpx',
							// height: '44rpx'
						}
					},
					{
						id: 5,
						name: '我的',
						url: '/pages/my/my',
						image: require('@/static/tabbar/my.png'),
						imagea: require('@/static/tabbar/mya.png'),
						imgSty: {
							// width: '40rpx',
							// height: '44rpx'
						}
					}
				],
			}
		},
		onLoad() {},
		onShow() {

		},
		methods: {
			change(e) {
				let index = this.list.findIndex(item => item.id == e)
				let url = this.list[index].url
				uni.switchTab({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
</style>